//
//  MLParticipantsCell.m
//  LetsParty
//
//  Created by MLin on 15/9/15.
//  Copyright (c) 2015年 LetsPartyTeam. All rights reserved.
//

#import "MLParticipantsCell.h"

@interface MLParticipantsCell ()

@end

@implementation MLParticipantsCell

#pragma mark - init

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initCellAppearance];
    }
    return self;
}

-(void)initCellAppearance{
    [self addSubview:self.nameLabel];
    [self addSubview:self.phLabel];
    [self addSubview:self.phonenumberLabel];
    [self addSubview:self.phoneButton];
}


#pragma mark - action
-(void)btnClickedTransferToDelegate{
    if ([self.delegate respondsToSelector:@selector(btnClickedEvent:)]) {
        [self.delegate btnClickedEvent:self.phonenumberLabel.text];
    }
    
}

#pragma mark - getter
-(UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = ({
            UILabel *label = [[UILabel alloc]init];
            label.frame = DHFlexibleFrame(CGRectMake(20, 0, 100, 30), YES);
            label;
        });
        _nameLabel.font = [UIFont systemFontOfSize:16 * DHFlexibleVerticalMutiplier()];
    }
    return _nameLabel;
}

-(UILabel *)phLabel{
    if (!_phLabel) {
        _phLabel = ({
            UILabel *label = [[UILabel alloc]init];
            label.frame = DHFlexibleFrame(CGRectMake(20, 25, 50, 20), YES);
            label;
        });
        _phLabel.text = @"手机号:";
        _phLabel.textColor = [UIColor darkGrayColor];
        _phLabel.font = [UIFont systemFontOfSize:13 * DHFlexibleVerticalMutiplier()];
    }
    return _phLabel;
}

-(UILabel *)phonenumberLabel{
    if (!_phonenumberLabel) {
        _phonenumberLabel = ({
            UILabel *label = [[UILabel alloc]init];
            label.frame = DHFlexibleFrame(CGRectMake(70, 25, 120, 20), YES);
            label;
        });
        _phonenumberLabel.textColor = [UIColor darkGrayColor];
        _phonenumberLabel.font = [UIFont systemFontOfSize:13 * DHFlexibleVerticalMutiplier()];
    }
    return _phonenumberLabel;
}

-(UIButton *)phoneButton{
    if (!_phoneButton) {
        _phoneButton = ({
            UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = DHFlexibleFrame(CGRectMake(280, 11, 30, 30), YES);
            [button setImage:[UIImage imageNamed:@"iconfont-shouji"] forState:UIControlStateNormal];
            // 代理方法
            [button addTarget:self action:@selector(btnClickedTransferToDelegate) forControlEvents:UIControlEventTouchUpInside];
            button;
        });
    }
    return _phoneButton;
}



@end
